package thread;
/*
静态方法锁：



 */

public class SyncDemo3 {
    public static void main(String[] args) {
        Boo b1=new Boo();
        Boo b2=new Boo();
        Thread t1=new Thread(){
            public void run(){
                Boo.doSome();
//                b1.doSome();
            }
        };
        Thread t2=new Thread(){
            public void run(){
                Boo.doSome();
//                b2.doSome();
            }
        };
        t1.start();
        t2.start();
    }
}
class Boo{
//    public synchronized static void doSome(){
    public static void doSome(){
        synchronized (Boo.class){
            try {
                Thread t=Thread.currentThread();
                System.out.println(t.getName()+":正在执行dosome方法....");
                Thread.sleep(5000);
                System.out.println(t.getName()+":执行doSome方法完毕");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }

    }
}
